<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="/">Hogwarts</a>
    </div>
    <!-- Top Menu Items -->
    <!-- 判断用户是否登录, 决定显示状态 -->

    {% if request.user.is_authenticated %}
        <div class="nav navbar-right top-nav" style="color:#ffffff;">欢迎您 : <span
                class="dl-log-user">{{ user.username }}</span><a href="/accounts/logout/" title=" 退出系统" class="dl-log-quit"> [退出]</a>
        </div>
        {% include 'nav_side.html' %}
        <!--  登录 -->
    {% else %}
        <!-- 未登录,显示登录按钮-->
        <div class="nav navbar-right top-nav">
            <div><a href="/signup/" onclick="" rel="nofollow" class="register btn">
                <span class="text"> 注册</span></a><a onclick="" rel="nofollow" href="#" class="login btn">
                <span class="text"> 登录</span></a></div>
        </div>

    {% endif %}



</nav>
